﻿using Program_GDI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Captcha
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        ValidCode validCode = new ValidCode(5, ValidCode.CodeType.Numbers);
        private void Form1_Load(object sender, EventArgs e)
        {
            picValidCode.Image = Bitmap.FromStream(validCode.CreateCheckCodeImage());
        }
        private void btnComfirm_Click(object sender, EventArgs e)
        {
            if (!this.txtValidCode.Text.Equals(validCode.CheckCode))//验证是否输入正确
            {

                MessageBox.Show(" 请输入正确的验证码!", this.Text);

                this.txtValidCode.Focus();
                this.txtValidCode.Text = "";
                return;

            }
            else
            {
                MessageBox.Show("成功！");
            }
        }

     
    }
}
